package com.puzzlebazar.client.main.model;

import java.util.Vector;

public class LinkGroup {
	
	private final String groupName;

	private final Vector<AutoLink> links = new Vector<AutoLink>();

	/**
	 * Create a group of links with a specific name
	 * 
	 * @param groupName The name of this group of links
	 */
	public LinkGroup( String groupName ) {
		this.groupName = groupName;
	}

	/**
	 * Adds a new link to the link group
	 * 
	 * @param link Link to add
	 */
	public void addLink(AutoLink link) {
		links.add( link );
	}

	/**
	 * @return The number of links in this group
	 */
	public int getLinkCount() {
		return links.size();
	}
	
	/**
	 * Retrieves the link at the specified index, null if there is no such link
	 * 
	 * @param idx The index at which to get the link
	 * @return The link at the specified index, or null if there is no such link
	 */
	public AutoLink getLink( int idx ) {
		if( idx < 0 || idx >= links.size() )
			return null;
		return links.get(idx);		
	}
	
	/**
	 * @return The name of this group
	 */
	public String getName() {
		return groupName;
	}
}
